/**
 * Copyright (C), 2020, XXX有限公司
 * FileName: SucerityConfig
 * Author:   Administrator
 * Date:     2020/5/9 14:57
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.fmyexample.v2mcsecuritybootjdbc.sucerity;

import com.fmy.mcsecurity.token.TokenStorage;
import com.fmy.mcsecurity.token.impl.JdbcTokenStorage;
import com.fmy.mcsecurity.token.impl.jdbc.JdbcLoginService;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.security.core.userdetails.UserDetailsService;

/**
 * <br>
 *     JDBC方式实现
 * </br>
 *
 * @author Administrator
 * @create 2020/5/9
 * @since 1.0.0
 */
//@Configuration
public class SecurityJdbcConfig extends SecurityAdapterConfig {

    private final JdbcTemplate jdbcTemplate;

    protected SecurityJdbcConfig(UserDetailsService userDetailsService, JdbcTemplate jdbcTemplate) {
        super(userDetailsService);
        this.jdbcTemplate = jdbcTemplate;
    }

    @Override
    public TokenStorage tokenStorage() {
        return new JdbcTokenStorage(new JdbcLoginService(jdbcTemplate));
    }
}